import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../components/home/home.vue'
import Index from '../components/index/index.vue'
import About from '../components/about/about.vue'
import Product from '../components/product/product.vue'
import Custom from '@/components/custom/custom'
import Case from '@/components/case/case'

Vue.use(VueRouter)

  const routes = [
  {
    path: '/',
    name: 'Home',
    component: Home,
    redirect: '/index',
    children: [
      { path: '/index', component: Index ,name:'index'},
      { path: '/about', component: About ,name:'about' },
      { path: '/product', component: Product, name:'product'},
      { path: '/custom', component: Custom, name: 'Custom' },
      { path: '/case', component: Case, name: 'Case' },

    ]
  }
]

const router = new VueRouter({
  routes
})


//去除重复点击路由警告
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

export default router
